package com.fxz.distributedlimiter;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Fxz
 * @version 1.0
 * @date 2022-02-02 20:16
 */
@Slf4j
public class ExceptionUtil {

    /**
     * 限流处理方法
     * 返回值与SentinelResource下的方法相同 形参为SentinelResource下形参+BlockException
     *
     * @param ex
     * @return
     */
    public static String handleException(BlockException ex) {
        log.info("Oops: " + ex.getClass().getCanonicalName());
        log.info("==================================");
        return "error";
    }
}
